// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-21

#ifndef __WND_H_COMMON_UI__
#define __WND_H_COMMON_UI__

#pragma once

#include "ctrl.h"

//##ModelId=44C4B60200AB
class CJoyWnd : public CWnd, public CJoyCtrl
{
	DECLARE_DYNAMIC(CJoyWnd)
protected:

	//##ModelId=44C4B60200AE
    bool        m_needDraw;
    //bool        m_hovered;
    //CJoyCtrl*   m_hoveredCtrl;
    //CJoyCtrl*   m_captureCtrl;
    //CJoyCtrl*   m_activeCtrl;

	//##ModelId=44C4B60200BB
    void DoTrackMouseLeave(bool bTrack);
	//##ModelId=44C4B60200BD
    void DoMouseMessage(MouseMessage msg, const CPoint& pt);
	//##ModelId=44C4B60200CD
    LRESULT DoHitTest(const CPoint& pt);
	//##ModelId=44C4B60200CF
    virtual void DoAlignChilds(CRect& remain);

	//##ModelId=44C4B60200DC
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B60200DF
    virtual void CM_Visible(bool v);

public:
	//##ModelId=44C4B60200EC
    CJoyWnd(void);
	//##ModelId=44C4B60200EE
    virtual ~CJoyWnd(void);
	//##ModelId=44C4B60200FC
    void InvalidateCtrl()
    {
        InvalidateCtrl(CRect(0, 0, m_area.Width(), m_area.Height()));
    }

	//##ModelId=44C4B60200FD
    void GetClientArea(CRect& area);
	//##ModelId=44C4B6020109
    virtual bool Create(CWnd* parent, const CRect& area);

	//##ModelId=44C4B602010D
    virtual void SetVisible(bool v);
	//##ModelId=44C4B602011B
    virtual void NotifyAlign();
	//##ModelId=44C4B602011D
    virtual void LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B6020128
    virtual bool IsWnd();
	//##ModelId=44C4B602012A
    virtual void AlignChilds();
	//##ModelId=44C4B6020138
    virtual void SetArea(const CRect& area);
	//##ModelId=44C4B602013B
    virtual void SetArea(const CRect& area, bool bRepaint);
	//##ModelId=44C4B6020148
    virtual void Destroy();
	//##ModelId=44C4B602014A
    virtual void InvalidateCtrl(const CRect& area);
	//##ModelId=44C4B6020157
    virtual void SetCtrlCapture(CJoyCtrl* pCtrl);
	//##ModelId=44C4B602015A
    virtual void ReleaseCtrlCapture(CJoyCtrl* pCtrl);
	//##ModelId=44C4B6020168
    virtual void SetAlign(AlignType align);
	//##ModelId=44C4B6020177
    virtual void SetEnabled(bool e);
	//##ModelId=44C4B602017A
    virtual void CtrlToScreen(CPoint& pt);

public:
	//##ModelId=44C4B6020186
    LRESULT WMMouseLeave(WPARAM wParam, LPARAM lParam);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B6020189
    afx_msg HRESULT OnNotifyAlign(WPARAM, LPARAM);
	//##ModelId=44C4B6020196
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//##ModelId=44C4B6020199
    afx_msg void OnDestroy();
	//##ModelId=44C4B602019B
    afx_msg void OnPaint();
	//##ModelId=44C4B602019D
    afx_msg void OnSize(UINT nType, int cx, int cy);
	//##ModelId=44C4B60201A9
    afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
	//##ModelId=44C4B60201AD
    afx_msg LRESULT OnNcHitTest(CPoint point);
	//##ModelId=44C4B60201B7
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//##ModelId=44C4B60201BB
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//##ModelId=44C4B60201C6
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	//##ModelId=44C4B60201D5
    afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	//##ModelId=44C4B60201D9
    afx_msg void OnEnable(BOOL bEnable);
	//##ModelId=44C4B60201DC
    afx_msg void OnSetFocus(CWnd* pOldWnd);
	//##ModelId=44C4B60201E6
    afx_msg void OnMove(int x, int y);
	//##ModelId=44C4B60201EA
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//##ModelId=44C4B60201F5
    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
};

#endif  // __WND_H_COMMON_UI__
